<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加英雄</title>
</head>
<body>

<form class="layui-form" lay-filter="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                <blockquote class="layui-elem-quote">基础信息</blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        武将名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入武将名称"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <text style="color:red;">图片尺寸建议 1:1比例</text>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        武将图示</label>
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="icon"
                             data-dir="xm_game/sgz/generals/icon"
                             data-accept="image"
                             data-type="ali-oss"
                             data-layVerify="required"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <text style="color:red;">图片尺寸建议 7:10比例</text>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        武将大图</label>
                    <div class="layui-input-block">
                        <div class="laytpUpload"
                             data-name="picture"
                             data-dir="xm_game/sgz/generals/picture"
                             data-accept="image"
                             data-type="ali-oss"
                             data-layVerify="required"
                             data-showChoiceBtn="false"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        星级</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="star"
                             data-sourceType="data"
                             data-source="[{name:'3',value:'3'},{name:'4',value:'4'},{name:'5',value:'5'}]"
                             data-radio="true"
                             data-placeholder="请选择星级"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        阵营</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="camp"
                             data-sourceType="data"
                             data-source="[{name:'魏',value:'魏'},{name:'蜀',value:'蜀'},{name:'吴',value:'吴'},{name:'群',value:'群'}]"
                             data-radio="true"
                             data-placeholder="请选择阵营"
                        ></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        统御值</label>
                    <div class="layui-input-block">
                        <input type="number" min="3" max="7" name="dominance_value" lay-verify="required"
                               autocomplete="off" placeholder="请输入3-7统御值" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item ">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        赛季版本</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="season"
                             data-sourceType="data"
                             data-source="[{name:'PK',value:'PK'},{name:'S1',value:'S1'},{name:'S2',value:'S2'},{name:'S3',value:'S3'}]"
                             data-radio="true"
                             data-placeholder="请选择赛季版本"
                        ></div>
                    </div>
                </div>
                <blockquote class="layui-elem-quote">基础属性</blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        基础武力</label>
                    <div class="layui-input-inline">
                        <input type="number" name="basic_force" lay-verify="required" autocomplete="off"
                               placeholder="请输入初始武力" class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        基础智力</label>
                    <div class="layui-input-inline">
                        <input type="number" name="basic_intelligence" lay-verify="required" autocomplete="off"
                               placeholder="请输入初始智力"
                               class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        基础政治</label>
                    <div class="layui-input-inline">
                        <input type="number" name="basic_politics" lay-verify="required" autocomplete="off"
                               placeholder="请输入初始政治"
                               class="layui-input">
                    </div>

                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        基础统帅</label>
                    <div class="layui-input-inline">
                        <input type="number" name="basic_commander" lay-verify="required" autocomplete="off"
                               placeholder="请输入初始统帅"
                               class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        基础速度</label>
                    <div class="layui-input-inline">
                        <input type="number" name="basic_speed" lay-verify="required" autocomplete="off"
                               placeholder="请输入初始速度"
                               class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        基础魅力</label>
                    <div class="layui-input-inline">
                        <input type="number" name="basic_charm" lay-verify="required" autocomplete="off"
                               placeholder="请输入初始魅力"
                               class="layui-input">
                    </div>
                </div>
                <blockquote class="layui-elem-quote">成长属性</blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        成长武力</label>
                    <div class="layui-input-inline">
                        <input type="number" step="0.01" name="growing_force" lay-verify="required" autocomplete="off"
                               placeholder="请输入成长武力" class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        成长智力</label>
                    <div class="layui-input-inline">
                        <input type="number" name="growing_intelligence" lay-verify="required" autocomplete="off"
                               placeholder="请输入成长智力"
                               class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        成长政治</label>
                    <div class="layui-input-inline">
                        <input type="number" name="growing_politics" lay-verify="required" autocomplete="off"
                               placeholder="请输入成长政治"
                               class="layui-input">
                    </div>

                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        成长统帅</label>
                    <div class="layui-input-inline">
                        <input type="number" name="growing_commander" lay-verify="required" autocomplete="off"
                               placeholder="请输入成长统帅"
                               class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        成长速度</label>
                    <div class="layui-input-inline">
                        <input type="number" name="growing_speed" lay-verify="required" autocomplete="off"
                               placeholder="请输入成长速度"
                               class="layui-input">
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        成长魅力</label>
                    <div class="layui-input-inline">
                        <input type="number" name="growing_charm" lay-verify="required" autocomplete="off"
                               placeholder="请输入成长魅力"
                               class="layui-input">
                    </div>
                </div>
                <blockquote class="layui-elem-quote">兵种</blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        骑兵</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="cavalry_level"
                             data-sourceType="data"
                             data-source="[{name:'S',value:'S'},{name:'A',value:'A'},{name:'B',value:'B'},{name:'C',value:'C'}]"
                             data-radio="true"
                             data-placeholder="请选择"
                        ></div>
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        盾兵</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="mauler_level"
                             data-sourceType="data"
                             data-source="[{name:'S',value:'S'},{name:'A',value:'A'},{name:'B',value:'B'},{name:'C',value:'C'}]"
                             data-radio="true"
                             data-placeholder="请选择"
                        ></div>
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        弓兵</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="bowman_level"
                             data-sourceType="data"
                             data-source="[{name:'S',value:'S'},{name:'A',value:'A'},{name:'B',value:'B'},{name:'C',value:'C'}]"
                             data-radio="true"
                             data-placeholder="请选择"
                        ></div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        枪兵</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="spearman_level"
                             data-sourceType="data"
                             data-source="[{name:'S',value:'S'},{name:'A',value:'A'},{name:'B',value:'B'},{name:'C',value:'C'}]"
                             data-radio="true"
                             data-placeholder="请选择"
                        ></div>
                    </div>
                    <label class="layui-form-label">
                        <text title="必填项" style="color:red;">*</text>
                        器械</label>
                    <div class="layui-input-inline">
                        <div class="xmSelect"
                             data-name="apparatus_level"
                             data-sourceType="data"
                             data-source="[{name:'S',value:'S'},{name:'A',value:'A'},{name:'B',value:'B'},{name:'C',value:'C'}]"
                             data-radio="true"
                             data-placeholder="请选择"
                        ></div>
                    </div>
                </div>
                <blockquote class="layui-elem-quote">战法</blockquote>
                <div class="layui-form-item">
                    <label class="layui-form-label"><text style="color:red;">*</text>武将战法</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="normal_method"
                             data-sourceType="route"
                             data-source="/admin.sgz.warMethods/index"
                             data-textField="name"
                             data-valueField="id"
                             data-paging="true"
                             data-radio="true"
                             data-direction="up">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><text style="color:red;">*</text>传承战法</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="special_method"
                             data-sourceType="route"
                             data-source="/admin.sgz.warMethods/index"
                             data-textField="name"
                             data-valueField="id"
                             data-paging="true"
                             data-radio="true"
                             data-direction="up">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">列传</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入列传" name="biographies" class="layui-textarea" ></textarea>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="add">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script>
    if (localStorage.getItem("staticDomain")) {
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/jquery_3.3.1.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/jquery.tablednd.js?v=" + localStorage.getItem("version") + "'><\/script>");
    } else {
        document.write("<link rel='stylesheet' href='/static/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/jquery_3.3.1.js?v=" + localStorage.getItem("version") + "'><\/script>");
        document.write("<script src='/static/component/jquery.tablednd.js?v=" + localStorage.getItem("version") + "'><\/script>");
    }
</script>
<script>
    layui.use(['laytp'], function () {
        layui.form.on('submit(add)', function (data) {
            var btnAnim = layui.button.load({elem: $(this)});
            facade.ajax({
                route: '/admin.sgz.generals/add',
                data: data.field
            }).done(function (res) {
                if (res.code === 0) {
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reload("laytp-table");
                }
                btnAnim.stop();
            }).fail(function () {
                btnAnim.stop();
            });
            return false;
        });
    })
</script>
</body>
</html>